package com.zzh.lib.core.model;

import android.os.Parcel;
import android.os.Parcelable;

public class HVideoFileModel extends HFileModel implements Parcelable {
    private long duration;
    private String thumbnail;

    public long getDuration() {
        return duration;
    }

    public void setDuration(long duration) {
        this.duration = duration;
    }

    public String getThumbnail() {
        return thumbnail == null ? "" : thumbnail;
    }

    public void setThumbnail(String thumbnail) {
        this.thumbnail = thumbnail;
    }


    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        super.writeToParcel(dest, flags);
        dest.writeLong(this.duration);
        dest.writeString(this.thumbnail);
    }

    public void readFromParcel(Parcel source) {
        super.readFromParcel(source);
        this.duration = source.readLong();
        this.thumbnail = source.readString();
    }

    public HVideoFileModel() {
    }

    protected HVideoFileModel(Parcel in) {
        super(in);
        this.duration = in.readLong();
        this.thumbnail = in.readString();
    }

    public static final Creator<HVideoFileModel> CREATOR = new Creator<HVideoFileModel>() {
        @Override
        public HVideoFileModel createFromParcel(Parcel source) {
            return new HVideoFileModel(source);
        }

        @Override
        public HVideoFileModel[] newArray(int size) {
            return new HVideoFileModel[size];
        }
    };

    @Override
    public String toString() {
        return "HVideoFileModel{" +
                "duration=" + duration +
                ", thumbnail='" + thumbnail + '\'' + ", parent: " + super.toString() +
                '}';
    }
}
